package shiyan3;

public class SparseMatrixMain {
    public static void main(String[] args) {
        // Example: create a 6x7 sparse matrix and set a few non-zero values
        SparseMatrix A = new SparseMatrix(6, 7);
        A.set(1, 3, 5.0);
        A.set(2, 2, -2.5);
        A.set(2, 6, 3.14);
        A.set(4, 1, 9.0);
        A.set(6, 7, 1.0);
        A.set(6, 7, 2.0); // overwrite
        A.set(2, 2, 0.0); // remove one value to demonstrate deletion

        // Output dense matrix
        A.printMatrix();
        System.out.println();

        // Output info
        A.printInfo();
        System.out.println();

        // Demonstrate get
        System.out.println("A[1,3] 的值 = " + A.get(1, 3));
        System.out.println("A[2,2] 的值 = " + A.get(2, 2));
        System.out.println("A[6,7] 的值 = " + A.get(6, 7));
    }
}
